# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Alessio 'mOLOk' Bolognino <themolok@gmail.com>
# Contributor: shamrok <szamrok@gmail.com>

pkgname=smplayer
pkgver=22.7.0
pkgrel=2
pkgdesc='Media player with built-in codecs that can play virtually all video and audio formats'
url='https://www.smplayer.info/'
arch=('loong64' 'x86_64')
license=('GPL')
depends=('glibc' 'qt5-base' 'mpv' 'libx11' 'zlib' 'gcc-libs' 'hicolor-icon-theme')
makedepends=('qt5-tools')
optdepends=('smplayer-themes: icon themes collection'
            'smplayer-skins: skin themes collection'
#           'smtube: browse and play youtube videos'
            'youtube-dl: youtube videos and streaming'
            'yt-dlp: youtube videos and streaming'
            'mplayer: alternative multimedia engine')
source=(https://github.com/smplayer-dev/${pkgname}/releases/download/v$pkgver/${pkgname}-${pkgver}.tar.bz2)
sha512sums=('ab87bec6cc3da115782a9384ff0a429343d82290dedc216344b71e50f54a45b11b9b77dd0224d64079b1717b6c23c8a5853dc5ca2c47e3bf309254d4b1c4cd8b')
b2sums=('f1133a084586c9b2d46348981db7bd887eaa494cd372f2e94074ef567d0bbe146cebcf52e089a05318c4468667325d3c4d6664fc162224c620e671c4b49466bd')

prepare() {
  cd ${pkgname}-${pkgver}
  # make build reproducible, we compress ourselves
  sed '/gzip -9/d' -i Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  export CXXFLAGS="${CXXFLAGS} ${CPPFLAGS}"
  make \
    PREFIX=/usr \
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE \
    CFLAGS_EXTRA="${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" \
    all
}

package() {
  cd ${pkgname}-${pkgver}
  make \
    PREFIX=/usr \
    DOC_PATH=/usr/share/doc/smplayer \
    DESTDIR="${pkgdir}" \
    install
}

# vim: ts=2 sw=2 et:
